<?php
	if(isset($noticeId)){
		$favor ='<span class="ui-icon ui-icon-heart"></span><a href="#" id="favor-link-'.$noticeId.'">'.__('Favor', true).'</a>';
		echo $favor;
?>
<script type="text/javascript">
$("#<?php echo 'favor-link-'.$noticeId;?>").bind("click", function (event) {
	$.ajax({
		data:"data[Favor][notice_id]=<?php echo $noticeId ?>", 
		dataType:"html", 
		error:function (
			XMLHttpRequest, 
			textStatus, 
			errorThrown) {
			alert(errorThrown)
			}, 
		success:function (data, textStatus) {
			favor(data, <?php echo $noticeId ?>)
			}, 
		type:"POST", 
		url:"\/bayon\/favors\/add"
		}
	); 
	return false;});
	
</script>
<?php }?>